package day16;

import java.util.ArrayList;
import java.util.Iterator;

public class ArrayListDemo {
    public static void main(String[] args) {
        ArrayList array = new ArrayList<>();

        array.add("aaa");
        array.add("aaa");

        // 迭代器
        Iterator it = array.iterator();
        while (it.hasNext()) {
            String s = (String)it.next();
            System.out.println(s);
        }

        // 普通for
        for (int i = 0; i < array.size(); i++) {
            String s = (String) array.get(i);
            System.out.println(s);
        }
    }
}
